﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.KlijentOsoba"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class KlijentOsobaEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ID property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxID;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ID property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDLabel;
		
		/// <summary>
		/// TextBox for the Ime property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxIme;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Ime property.
		/// </summary>
		protected System.Windows.Forms.Label uxImeLabel;
		
		/// <summary>
		/// TextBox for the Prezime property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxPrezime;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Prezime property.
		/// </summary>
		protected System.Windows.Forms.Label uxPrezimeLabel;
		
		/// <summary>
		/// TextBox for the Telefon property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxTelefon;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Telefon property.
		/// </summary>
		protected System.Windows.Forms.Label uxTelefonLabel;
		
		/// <summary>
		/// TextBox for the Mobitel property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMobitel;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Mobitel property.
		/// </summary>
		protected System.Windows.Forms.Label uxMobitelLabel;
		
		/// <summary>
		/// TextBox for the Fax property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxFax;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Fax property.
		/// </summary>
		protected System.Windows.Forms.Label uxFaxLabel;
		
		/// <summary>
		/// TextBox for the Email property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxEmail;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Email property.
		/// </summary>
		protected System.Windows.Forms.Label uxEmailLabel;
		
		/// <summary>
		/// ComboBox for the IDKlijent property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDKlijent;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDKlijent property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDKlijentLabel;
		
		/// <summary>
		/// ComboBox for the IDMjesto property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDMjesto;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDMjesto property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDMjestoLabel;
		#endregion
		
		#region Main entity
		private Entities.KlijentOsoba _KlijentOsoba;
		/// <summary>
		/// Gets or sets the <see cref="Entities.KlijentOsoba"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.KlijentOsoba"/> instance.</value>
		public Entities.KlijentOsoba KlijentOsoba
		{
			get {return this._KlijentOsoba;}
			set
			{
				this._KlijentOsoba = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxID.DataBindings.Clear();
			this.uxID.DataBindings.Add("Text", this.uxBindingSource, "ID", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIme.DataBindings.Clear();
			this.uxIme.DataBindings.Add("Text", this.uxBindingSource, "Ime", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxPrezime.DataBindings.Clear();
			this.uxPrezime.DataBindings.Add("Text", this.uxBindingSource, "Prezime", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTelefon.DataBindings.Clear();
			this.uxTelefon.DataBindings.Add("Text", this.uxBindingSource, "Telefon", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMobitel.DataBindings.Clear();
			this.uxMobitel.DataBindings.Add("Text", this.uxBindingSource, "Mobitel", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxFax.DataBindings.Clear();
			this.uxFax.DataBindings.Add("Text", this.uxBindingSource, "Fax", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxEmail.DataBindings.Clear();
			this.uxEmail.DataBindings.Add("Text", this.uxBindingSource, "Email", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDKlijent.DataBindings.Clear();
			this.uxIDKlijent.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDKlijent", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDMjesto.DataBindings.Clear();
			this.uxIDMjesto.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDMjesto", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="KlijentOsobaEditControlBase"/> class.
		/// </summary>
		public KlijentOsobaEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_KlijentOsoba != null) _KlijentOsoba.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxID = new System.Windows.Forms.TextBox();
			uxIDLabel = new System.Windows.Forms.Label();
			this.uxIme = new System.Windows.Forms.TextBox();
			uxImeLabel = new System.Windows.Forms.Label();
			this.uxPrezime = new System.Windows.Forms.TextBox();
			uxPrezimeLabel = new System.Windows.Forms.Label();
			this.uxTelefon = new System.Windows.Forms.TextBox();
			uxTelefonLabel = new System.Windows.Forms.Label();
			this.uxMobitel = new System.Windows.Forms.TextBox();
			uxMobitelLabel = new System.Windows.Forms.Label();
			this.uxFax = new System.Windows.Forms.TextBox();
			uxFaxLabel = new System.Windows.Forms.Label();
			this.uxEmail = new System.Windows.Forms.TextBox();
			uxEmailLabel = new System.Windows.Forms.Label();
			this.uxIDKlijent = new System.Windows.Forms.ComboBox();
			uxIDKlijentLabel = new System.Windows.Forms.Label();
			this.uxIDMjesto = new System.Windows.Forms.ComboBox();
			uxIDMjestoLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIDLabel
			//
			this.uxIDLabel.Text = "ID:";
			this.uxIDLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIDLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDLabel);			
			//
			// uxID
			//
			this.uxID.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxID);
			this.uxID.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxID);
			//
			// uxImeLabel
			//
			this.uxImeLabel.Text = "Ime:";
			this.uxImeLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxImeLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxImeLabel);			
			//
			// uxIme
			//
			this.uxIme.Width = 250;
			this.uxIme.MaxLength = 100;
			//this.uxTableLayoutPanel.Controls.Add(this.uxIme);
			this.uxIme.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxIme);
			//
			// uxPrezimeLabel
			//
			this.uxPrezimeLabel.Text = "Prezime:";
			this.uxPrezimeLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxPrezimeLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxPrezimeLabel);			
			//
			// uxPrezime
			//
			this.uxPrezime.Width = 250;
			this.uxPrezime.MaxLength = 100;
			//this.uxTableLayoutPanel.Controls.Add(this.uxPrezime);
			this.uxPrezime.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxPrezime);
			//
			// uxTelefonLabel
			//
			this.uxTelefonLabel.Text = "Telefon:";
			this.uxTelefonLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxTelefonLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTelefonLabel);			
			//
			// uxTelefon
			//
			this.uxTelefon.Width = 250;
			this.uxTelefon.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxTelefon);
			this.uxTelefon.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxTelefon);
			//
			// uxMobitelLabel
			//
			this.uxMobitelLabel.Text = "Mobitel:";
			this.uxMobitelLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxMobitelLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMobitelLabel);			
			//
			// uxMobitel
			//
			this.uxMobitel.Width = 250;
			this.uxMobitel.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxMobitel);
			this.uxMobitel.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxMobitel);
			//
			// uxFaxLabel
			//
			this.uxFaxLabel.Text = "Fax:";
			this.uxFaxLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxFaxLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxFaxLabel);			
			//
			// uxFax
			//
			this.uxFax.Width = 250;
			this.uxFax.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxFax);
			this.uxFax.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxFax);
			//
			// uxEmailLabel
			//
			this.uxEmailLabel.Text = "Email:";
			this.uxEmailLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxEmailLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxEmailLabel);			
			//
			// uxEmail
			//
			this.uxEmail.Width = 250;
			this.uxEmail.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxEmail);
			this.uxEmail.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxEmail);
			//
			// uxIDKlijentLabel
			//
			this.uxIDKlijentLabel.Text = "IDKlijent:";
			this.uxIDKlijentLabel.Location = new System.Drawing.Point(3, 182);
			this.Controls.Add(this.uxIDKlijentLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDKlijentLabel);			
			//
			// uxIDKlijent
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDKlijent);
			this.uxIDKlijent.Location = new System.Drawing.Point(160, 182);
			this.Controls.Add(this.uxIDKlijent);
			//
			// uxIDMjestoLabel
			//
			this.uxIDMjestoLabel.Text = "IDMjesto:";
			this.uxIDMjestoLabel.Location = new System.Drawing.Point(3, 208);
			this.Controls.Add(this.uxIDMjestoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDMjestoLabel);			
			//
			// uxIDMjesto
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDMjesto);
			this.uxIDMjesto.Location = new System.Drawing.Point(160, 208);
			this.Controls.Add(this.uxIDMjesto);
			//
			// uxIDKlijent
			//				
			this.uxIDKlijent.DisplayMember = "ImeKlijenta";	
			this.uxIDKlijent.ValueMember = "ID";	
			//
			// uxIDMjesto
			//				
			this.uxIDMjesto.DisplayMember = "Naziv";	
			this.uxIDMjesto.ValueMember = "ID";	
			// 
			// KlijentOsobaEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "KlijentOsobaEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Klijent> _IDKlijentList;
		
		/// <summary>
		/// The ComboBox associated with the IDKlijent property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Klijent> IDKlijentList
		{
			get {return _IDKlijentList;}
			set 
			{
				this._IDKlijentList = value;
				this.uxIDKlijent.DataSource = null;
				this.uxIDKlijent.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDKlijentList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDKlijent property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKlijentList
		{
			get { return _allowNewItemInIDKlijentList;}
			set
			{
				this._allowNewItemInIDKlijentList = value;
				this.uxIDKlijent.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.Mjesto> _IDMjestoList;
		
		/// <summary>
		/// The ComboBox associated with the IDMjesto property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Mjesto> IDMjestoList
		{
			get {return _IDMjestoList;}
			set 
			{
				this._IDMjestoList = value;
				this.uxIDMjesto.DataSource = null;
				this.uxIDMjesto.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDMjestoList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDMjesto property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDMjestoList
		{
			get { return _allowNewItemInIDMjestoList;}
			set
			{
				this._allowNewItemInIDMjestoList = value;
				this.uxIDMjesto.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
